package com.spark.modules.system.entity;

import com.baomidou.mybatisplus.annotation.OrderBy;
import com.baomidou.mybatisplus.annotation.TableName;
import com.spark.common.annotation.Dict;
import com.spark.common.annotation.query.Query;
import com.spark.common.constants.QueryConstants;
import com.spark.common.constants.RegexConstants;
import com.spark.common.core.entity.BaseTreeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 系统部门
 *
 * @author LYCHEE
 * @date 2025/02/18 14:13
 */
@Data
@TableName("sys_dept")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class SysDept extends BaseTreeEntity<SysDept> {

    /**
     * 部门名称
     */
    @Query(QueryConstants.QUERY_LIKE)
    @NotBlank(message = "部门名称不能为空")
    private java.lang.String deptName;

    /**
     * 排序
     */
    @OrderBy(asc = true, sort = 1)
    private java.lang.Integer sortRank;

    /**
     * 负责人
     */
    @NotBlank(message = "负责人不能为空")
    private java.lang.String leader;

    /**
     * 联系电话
     */
    @Pattern(regexp = RegexConstants.PHONE_REGEX, message = "请输入有效的手机号")
    private java.lang.String phone;

    /**
     * 邮箱
     */
    @Email(message = "请输入有效的电子邮件地址")
    private java.lang.String email;

    /**
     * 描述
     */
    private java.lang.String description;

    /**
     * 状态
     * : 0正常 1禁用
     */
    @Query
    @NotNull(message = "状态不能为空")
    @Dict(dictCode = "status")
    private java.lang.Integer status;

    /**
     * 祖先编码
     */
    private java.lang.String ancestorIds;

}
